import runner.BasicEnv
import runner.Environment
import stone.*
import stone.ast.NullStmt

object Main {
  @Throws(ParseException::class)
  @JvmStatic
  fun main(args: Array<String>) {
    run(BasicParser(), BasicEnv())
  }

  @Throws(ParseException::class)
  fun run(bp: BasicParser, env: Environment?) {
    val lexer = Lexer(CodeDialog())
    while (lexer.peek(0) !== Token.EOF) {
      val t = bp.parse(lexer)
      if (t !is NullStmt) {
        val r = t.eval(env)
        println("=> $r")
      }
    }
  }
}
